/**
 * 禁用、启用
 * */
// ===================================================================== Lazy
const Confirm = window.$Lazy.file(()=>import('@antd/common/confirm-submit'))
// ===================================================================== 
const Index = function(enable, option){
	let { param, query, label1='启用', label2='禁用', uuid, idStr='uuid', isKeys, off, on, api, onComplete } = option || {}
	
	let label = null
	
	if(enable === 1){ 
		api = api ? api : on
		label = label1
	}else if( enable === 0 ){
		api = api ? api : off
		label = label2
	}
	
	const disabled = isKeys ? { disabled: !window.$fn.hasArray(this.state.selectedKeys) } : null
	 
	return { label, loading:this.state.pagingLoading, ...disabled,  onClick:()=>{
		param = query ? query : { [idStr]: uuid ? uuid : this?.state?.selectedKeys, ...param  }
		Confirm.then( f=> f.call(this, api, { title:label, param, clear:false, onComplete }))
	} }
}
export default Index